function HOML(  )
%HOML_DEMO Summary of this function goes here
%   Detailed explanation goes here
load( 'medcine_ch' );
%Initialize the 100 feature subset for SA stage.
HammingLoss_msgg_mlknn = [];
RankingLoss_msgg_mlknn = [];
OneError_msgg_mlknn = [];
Coverage_msgg_mlknn = [];
Average_Precision_msgg_mlknn = [];

for foldnum = 1:10
    test = (indices == foldnum);
    train = ~test;
    train_input = data(train,:);
    test_input = data(test,:);
    train_target = targets(train,:);
    test_target = targets(test,:);
    
    u_target = train_target;
    v_target = test_target;
    
    
    % Divide the training data into two parts by 2:1, 2 for training, 1 for validation.
    num = size(train_input,1);
    [train_t,train_v] = crossvalind('HoldOut',num,0.33);
    train_t_input = train_input(train_t,:);     %Traning Set
    train_v_input = train_input(train_v,:);     %Validation Set
    train_t_target = train_target(train_t,:);   %Traning label
    train_v_target = train_target(train_v,:);   %Validation Label
    
    [ FS ] = InitIndividual(train_input);  %Initialize the 100 feature subsets
    
    
    %Simulated Annealing
    [ FS,E ] = SA( FS,Tk,train_t_input,train_v_input,train_t_target,train_v_target);
    
    %Genetic algorithm
    [ FS,E ] = GA( FS,E,Tg,pc,train_t_input,train_v_input,train_t_target,train_v_target);
    
    %Hill climbing to make further optimizaiton based on the previous two stages.
    [EF,I] = max(E);  %EF
    FN = FS(I,:);     %Best Feature-subset until now.
    
    Tp = Th;
    while Tp > 0
        [BF,BEF,Tc] = HC(FN,EF,Tp,train_t_input,train_v_input,train_t_target,train_v_target);
        FN = BF;
        EF = BEF;
        Tp = Tc;
    end
    
    din = find(BF);
    BF_Final = [BF_Final;BF];
    u = train_input(:,din);
    v = test_input(:,din);
    
    [Prior,PriorN,Cond,CondN]=MLKNN_train(u,u_target',10,1);
    [HammingLoss,RankingLoss,OneError,Coverage,Average_Precision,Outputs,Pre_Labels]=MLKNN_test(u,u_target',v,v_target',10,Prior,PriorN,Cond,CondN);
    HammingLoss_msgg_mlknn(foldnum) = HammingLoss;
    RankingLoss_msgg_mlknn(foldnum) = RankingLoss;
    OneError_msgg_mlknn(foldnum) = OneError;
    Coverage_msgg_mlknn(foldnum) = Coverage;
    Average_Precision_msgg_mlknn(foldnum) = Average_Precision;
end

end
